﻿package Classes.Utils{
	import flash.display.*;
	import flash.events.*;
	import flash.filters.DropShadowFilter;
	
	import Classes.Maps.*;
	import Classes.Utils.*;
	
	public class RateBar extends Sprite{
		public var max:Number;
		private var maskbar:Sprite;
		private var barwidth:Number;
		private var _val:Number;
		public function RateBar(){
			barwidth = this.width;
			maskbar = new Sprite();
			maskbar.graphics.beginFill(0x000000);
			maskbar.graphics.drawRect(0,0,this.width,this.height);
			maskbar.graphics.endFill();
			maskbar.x = this.x;
			maskbar.y = this.y;
			this.parent.addChild(maskbar);
			this.mask = maskbar;
		}
		
		public function set value(value:Number):void{
			_val = value;
			maskbar.width = _val/max*barwidth;
			if(_val < 0)
				maskbar.width = .1;
		}
		public function get value():Number{
			return _val;
		}
	}
}